package com.cgt.xiaotao.order.domain.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cgt.xiaotao.model.model.base.BaseEntity;
import com.cgt.xiaotao.order.handler.LongListJsonTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.util.List;

@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(description = "订单表")
@TableName("`order`")
public class Order extends BaseEntity {

    @ApiModelProperty(value = "订单ID")
    @TableId(type = IdType.AUTO)
    @TableField("id")
    private Long id;

    @ApiModelProperty(value = "订单编号")
    @TableField("order_no")
    private String orderNo;

    @ApiModelProperty(value = "用户ID")
    @TableField("user_id")
    private Long userId;

    @ApiModelProperty(value = "收货人姓名")
    @TableField("name")
    private String name;

    @ApiModelProperty(value = "收货人手机号")
    @TableField("phone")
    private String phone;

    @ApiModelProperty(value = "订单总金额")
    @TableField("total_amount")
    private BigDecimal totalAmount;

    @ApiModelProperty(value = "订单状态:0待付款 1待发货 2待收货 3已完成 4已取消")
    @TableField("status")
    private Byte status;

    @ApiModelProperty(value = "收货地址ID")
    @TableField("address")
    private String address;

    @ApiModelProperty(value = "支付记录ID")
    @TableField("payment_id")
    private Long paymentId;

    @ApiModelProperty(value = "订单备注")
    @TableField("remark")
    private String remark;

    @ApiModelProperty(value = "使用的优惠券ID列表")
    @TableField(value = "coupon_ids", typeHandler = LongListJsonTypeHandler.class)
    private List<Long> couponIds;
}